<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value=" ${pageContext.request.contextPath}" />
<html>
<head>
<title>整改有效性评价统计</title>
<script src="${ctx}/static/selectWin/orgSelector.js?version=${applicationScope.jsVersion }" type="text/javascript"></script>
<script src="${ctx}/static/selectWin/employeeSelector.js?version=${applicationScope.jsVersion }" type="text/javascript"></script>
<script type="text/javascript">
	var $grid, $detailGrid, selectTableRow;//选中的行数据
	var editIndex = -1;
	var grid;
	$(function() {
		$grid = $("#grid").datagrid(
				$.extend({}, datagridOption, {
					//url : "${ctx}/hr//dataGridStatistic",
					frozenColumns : [ [] ],
					columns : [ [
							{
								field : 'projectName',
								title : '项目名称',
								sortable : false,
								width : 100
							},{
								field : 'orgName',
								title : '部门名称',
								sortable : false,
								width : 80
							},{
								field : 'zgwcl',
								title : '整改完成率',
								sortable : false,
								width : 80
							} ,{
								field : 'zgjhastjl',
								title : '整改计划的按时提交率',
								sortable : false,
								width : 100
							},{
								field : 'zgjhyctgl',
								title : '整改计划的一次通过率',
								sortable : false,
								width : 100
							}  ,{
								field : 'zgcgastjl',
								title : '整改成果按时提交率',
								sortable : false,
								width : 100
							} ,{
								field : 'zzzgjgyctgl',
								title : '最终整改结果一次通过率',
								sortable : false,
								width : 100
							} ,{
								field : 'sjwtdqzgl',
								title : '审计问题到期整改率',
								sortable : false,
								width : 100
							} ] ],
					onDblClickRow : function(index, rowData) {
						$.isFunction(fn_edit) && fn_edit.call(this, rowData);
					},
					fitColumns:true
				}));

		fn_initComboNotId("type", "type", false);
		$orgSelector = $("#orgName").comboselector($.extend({},orgSelectOpts,{
			multiple : true,
			singleSelect : false,
			onEnter : function(val) {
				var orgIds = "";
				var orgName = "";
				for (var i = 0; i < val.length; i++) {
					orgIds = orgIds + val[i].id + ",";
					orgName = orgName + val[i].orgName + ",";
				}
				$("#orgIds").val(orgIds);
				$("#orgName").comboselector("setValue",orgName);
			}

		}));
		
		 setTimeout(function(){
			 //$("#search").click();
		 },100)


		$("#search").click(function() {
			var startDate=$("#startDate").datebox("getValue");
			var endDate=$("#endDate").datebox("getValue");
			var type=$("#type").combobox("getValue");
			var orgId=$("#orgIds").length>0?$("#orgName").comboselector("getValue")?$("#orgIds").val():"":"";
			if(!startDate){
				showAlert("请选择开始时间！");
				return;
			}
			if(!endDate){
				showAlert("请选择结束时间！");
				return;
			}

			$("#grid").datagrid("reload","${ctx}/fnd/auditPro/completionRateStatistic?startDate="+startDate+"&endDate="+endDate+"&type="+type+"&orgId="+orgId);
		});
		$("#excelExport").click(function() {
			var url = "${ctx}/fnd/auditPro/completionRateStatisticExcelExport";
			var startDate=$("#startDate").datebox("getValue");
			var endDate=$("#endDate").datebox("getValue");
			var type=$("#type").combobox("getValue");
			var orgId=$("#orgIds").length>0?$("#orgName").comboselector("getValue")?$("#orgIds").val():"":"";
			if(!startDate){
				showAlert("请选择开始时间！");
				return;
			}
			if(!endDate){
				showAlert("请选择结束时间！");
				return;
			}

			url=url+"?startDate="+startDate+"&endDate="+endDate+"&type="+type+"&orgId="+orgId;
			
			window.parent.location.href = url;
		});
		
		
		 
	});


		
</script>
</head>

<body>
	<div data-options="region:'center',fit:true,border:false">
		<table id="grid">
		</table>
	</div>
	<div id="tt" class="row">
		<div class="col-md-12">
			<table cellspacing="0" cellpadding="0">
				<tr>
					<td align="right"><span>开始时间：</span>
					<td><input id="startDate" type="text" class="easyui-datebox" /></td>
					<td align="right"><span>结束时间：</span>
					<td><input id="endDate" type="text" class="easyui-datebox" /></td>
					<td><span>类别：</span><input id="type" 
						class="easyui-combobox" ></td>
				<shiro:hasPermission name="auditProDtl:allQuery">
					<td><span>部门：</span><input id="orgIds" name="orgIds" type="hidden" /><input id="orgName" name="orgName" class="easyui-validatebox" data-options=""></td>	
				</shiro:hasPermission>
					<td><div class="dialog-tool-separator"></div></td>
					
					<td>
						<button id="search" type="button" class="btn btn-primary">
							<span class="glyphicon glyphicon-search"></span> 统计
						</button>
						<shiro:hasPermission name="auditProDtl:export">
						<button id="excelExport" type="button" class="btn btn-primary">
							<span class="glyphicon glyphicon-save"></span> 导出
						</button>
						</shiro:hasPermission>
					</td>
				</tr>
			</table>
		</div>
	</div>

</body>
</html>
